package com.wyy.travels.service.impl;/*
 **
 * @author yangyang
 *@date 2022/07/21 22:00
 **/

import com.wyy.travels.dao.ProvinceDao;
import com.wyy.travels.entity.Province;
import com.wyy.travels.service.ProvinceDaoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
@Slf4j
public class ProvinceDaoServiceImpl implements ProvinceDaoService {
     @Autowired
     private ProvinceDao provinceDao;
    @Override
    public List<Province> findByPage(Integer page, Integer rows) {
        int starts=(page-1)*rows;
        List<Province> byPage = provinceDao.findByPage(starts, rows);
        return byPage;
    }

    @Override
    public Integer findToals() {
        Integer toals = provinceDao.findToals();
        return toals;
    }

    @Override
    public void save(Province province) {
        province.setPlacecounts(0);
        provinceDao.save(province);
    }

    @Override
    public void delete(String id) {
        provinceDao.delete(id);
    }

    @Override
    public Province findOne(String id) {
        Province one = provinceDao.findOne(id);
        return one;
    }

    @Override
    public void update(Province province) {
        provinceDao.update(province);
    }
}
